package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo04 {
    public static void main(String[] args) {
        Collection c1=new ArrayList();
        c1.add("Hello");
        c1.add("World");

        System.out.println(c1);


        Collection c2=new HashSet();
        c2.add("Welcom");
        c2.add("China");
        c2.add("I");
        c2.add("Love");
        c2.add("you");
        c2.addAll(c1);
        System.out.println(c2);

        Collection c3=new ArrayList();
        c3.add("I");
        c3.add("you");
        boolean contains = c2.containsAll(c3);
        System.out.println("包含所有"+contains);

        System.out.println("c2"+c2);
        System.out.println("c3"+c3);
//        c2.retainAll(c3);
//        System.out.println("取交集c2"+c2);
//        System.out.println("取交集c3"+c3);

        System.out.println("删除交集");
        c2.removeAll(c3);
        System.out.println("c2"+c2);
        System.out.println("c3"+c3);

    }
}
